import grpc
import calculator_pb2
import calculator_pb2_grpc

def run():
    # 连接远程服务器
    channel = grpc.insecure_channel('localhost:50051')
    stub = calculator_pb2_grpc.CalculatorStub(channel)
    # 创建请求
    request = calculator_pb2.AddRequest(a=10, b=20)
    # 调用远程服务
    response = stub.Add(request)
    print(f"Result: {response.result}")

if __name__ == '__main__':
    run()